import { CrudOptions } from "@nestjsx/crud";
import { HandleStatus } from "libs/db/entity/enum/handle-status.enum";
import { NonOperatingAssets } from "libs/db/entity/non-operating-assets.entity";
import { LoggerInfo, moduleLoggerInfo } from "../_decorator/logger-info";

export const NonOperatingAssetsCrudOps: CrudOptions = {
  model: {
    type: NonOperatingAssets
  },
  query: {
     
    // join: {
    //   metadata: {
    //       
    //   },
    // },
    exclude:  ["updatedAt", "deleteAt"]
  },
  routes: {
    getManyBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('非经营性资产信息查询', HandleStatus.LOG)
        ),
      ],
    },
    getOneBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('单个非经营性资产信息查询', HandleStatus.LOG)
        ),
      ],
    },
    createOneBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('新增非经营性资产信息', HandleStatus.INFO)
        ),
      ],
      returnShallow: true,
    },
    createManyBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('非经营性资产信息上传', HandleStatus.DATA)
        ),
      ],
    },
    replaceOneBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('修改非经营性资产信息', HandleStatus.WARN)
        ),
      ],
      allowParamsOverride: true,
      returnShallow: true,
    },
    updateOneBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('修改非经营性资产信息', HandleStatus.WARN)
        ),
      ],
      allowParamsOverride: true,
      returnShallow: true,
    },
    deleteOneBase: {
      interceptors: [],
      decorators: [
        LoggerInfo(
          new moduleLoggerInfo ('删除非经营性资产信息', HandleStatus.ERROR)
        ),
      ],
      returnDeleted: true,
    },
  },
  dto: {
    create: NonOperatingAssets,
    replace: NonOperatingAssets
  },
  serialize: {
    getMany: NonOperatingAssets,
    get: NonOperatingAssets,
    create: NonOperatingAssets,
    createMany: NonOperatingAssets,
    update: NonOperatingAssets,
    replace: NonOperatingAssets,
    delete: NonOperatingAssets,
  }
}